package command;

import java.util.Map;

/**
 * @Author: Doream
 * @Date: 2022/1/29 20:48
 */
// 具体命令类，持有接收者对象
public class OrderCommand implements Command {
    private SeniorChef receiver;
    private Order order;

    public OrderCommand(SeniorChef receiver, Order order) {
        this.receiver = receiver;
        this.order = order;
    }

    @Override
    public void execute() {
        System.out.println(order.getTableNumber()+"桌的订单：");
        Map<String, Integer> foodDir = order.getFoodDir();
        for (String foodName : foodDir.keySet()) {
            receiver.makeFood(foodName,foodDir.get(foodName));
        }
        System.out.println(order.getTableNumber()+"桌的订单完成了！！！");
    }
}
